feat(core): M3.5-ext + M5.1-ext — pipeline analysis + plugin OS-sandbox wrap#30
Merged
Conversation
…ox wrap
· packages/core/src/sandbox/pipeline.ts (NEW)
- splitClauses(input) — minimal shell parser splitting on && || ; |
with single-quote / double-quote / backslash awareness.
- allClausesExcluded(input, excluded) — true iff EVERY clause leader is
in the excluded list. Prevents `git status && rm -rf /` from bypassing
the sandbox.
- 6 unit tests covering quoting, escapes, all-excluded, mixed pipelines.
· packages/core/src/sandbox/index.ts
- wrapBashCommand now uses allClausesExcluded() instead of "starts with
excluded + space". Documented behavior change: only whole-pipeline
excluded ⇒ bypass.
· packages/core/src/sandbox/attacks.test.ts
- Replaced the "pipeline bypass is documented behavior" test with a
"pipeline NO LONGER bypasses" test pinning the new semantics.
- Added a positive "all-git pipeline still bypasses" test.
· packages/core/src/plugins/runtime/subprocess.ts (M5.1-ext)
- PluginSubprocessOpts.sandbox?: SandboxConfig. When set + enabled,
wraps the node spawn under sandbox-exec (macOS) or bwrap (Linux).
Plugin's install dir is added to allowRead automatically.
- spawnAllPlugins() / SpawnAllOpts plumb the sandbox config through.
· packages/core/src/plugins/wireup.ts
- WirePluginsOpts.sandbox passes through to spawnAllPlugins().
· apps/cli/src/repl.ts + headless.ts
- Both pass settings.sandbox into wirePlugins() so the user can opt
plugins into OS sandboxing via settings.json.
Tests: core 416 → 429 (+13: 6 pipeline + attack-test rewrites). Total
463 → 476 passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
splitClauses + allClausesExcluded prevent 'git ... && rm -rf /' bypass. PluginSubprocess now optionally wraps node spawn in sandbox-exec / bwrap. 13 new tests. 463→476 passing.